from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy


login_manager = LoginManager()
db = SQLAlchemy()  # 实例化数据库


@login_manager.user_loader
def load_user(user_id):
    """回调函数"""
    from slewing.models import User
    user = User.query.get(int(user_id))
    return user
